/*
  Name: 3.3.2 practice, page 96
  Copyright: 
  Author: 
  Date: 15/07/09 09:39
  Description: 
*/
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	// conflict test
	// modified by Vincent
    int iarr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
    vector<int> ivec(iarr, iarr + 10);
    
    for(vector<int>::iterator itr = ivec.begin(); itr != ivec.end(); itr++)
    {
          cout << *itr << " ";
    }
    
    vector<int> ivec2;
    int temp_sum;
    for(vector<int>::iterator itr = ivec.begin(); itr != ivec.end(); itr++)
    {
          if(itr + 1 != ivec.end())
          {
                 temp_sum = (*itr + (*itr + 1));
                 ivec2.push_back(temp_sum);
          } 
    }
    
    cout << endl;
    
    for(vector<int>::iterator itr = ivec2.begin(); itr != ivec2.end(); itr++)
    {
          cout << *itr << " ";
    }      
          
                                 
    cout << endl;
    system("pause");
    return EXIT_SUCCESS;
    
}


